<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class MachineManager extends Model
{
    protected $fillable = [
        'manager_id', 'type', 'machine_id','percentage'
    ];


    public function admin()
    {
    	return $this->belongsTo(AdminUser::class, 'manager_id', 'id')->where('type',1);
    }

    public function broker()
    {
    	return $this->belongsTo(Broker::class, 'manager_id', 'id')->where('type',2);
    }

    public function merchant()
    {
    	return $this->belongsTo(Merchant::class, 'manager_id', 'id')->where('type',3);
    }
}
